package com.ruoyi.basic.service.impl;

import com.ruoyi.basic.domain.MenuCategory;
import com.ruoyi.basic.mapper.MenuCategoryMapper;
import com.ruoyi.basic.service.IMenuCategoryService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 菜单类别Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-13
 */
@Service
public class MenuCategoryServiceImpl implements IMenuCategoryService 
{
    @Autowired
    private MenuCategoryMapper menuCategoryMapper;

    /**
     * 查询菜单类别
     * 
     * @param mecId 菜单类别主键
     * @return 菜单类别
     */
    @Override
    public MenuCategory selectMenuCategoryByMecId(Long mecId)
    {
        return menuCategoryMapper.selectMenuCategoryByMecId(mecId);
    }

    /**
     * 查询菜单类别列表
     * 
     * @param menuCategory 菜单类别
     * @return 菜单类别
     */
    @Override
    public List<MenuCategory> selectMenuCategoryList(MenuCategory menuCategory)
    {
        return menuCategoryMapper.selectMenuCategoryList(menuCategory);
    }

    /**
     * 新增菜单类别
     * 
     * @param menuCategory 菜单类别
     * @return 结果
     */
    @Override
    public int insertMenuCategory(MenuCategory menuCategory)
    {
        menuCategory.setCreateTime(DateUtils.getNowDate());
        return menuCategoryMapper.insertMenuCategory(menuCategory);
    }

    /**
     * 修改菜单类别
     * 
     * @param menuCategory 菜单类别
     * @return 结果
     */
    @Override
    public int updateMenuCategory(MenuCategory menuCategory)
    {
        menuCategory.setUpdateTime(DateUtils.getNowDate());
        return menuCategoryMapper.updateMenuCategory(menuCategory);
    }

    /**
     * 批量删除菜单类别
     * 
     * @param mecIds 需要删除的菜单类别主键
     * @return 结果
     */
    @Override
    public int deleteMenuCategoryByMecIds(Long[] mecIds)
    {
        return menuCategoryMapper.deleteMenuCategoryByMecIds(mecIds);
    }

    /**
     * 删除菜单类别信息
     * 
     * @param mecId 菜单类别主键
     * @return 结果
     */
    @Override
    public int deleteMenuCategoryByMecId(Long mecId)
    {
        return menuCategoryMapper.deleteMenuCategoryByMecId(mecId);
    }
}
